﻿using System.Collections.Generic;
using System.Linq;
using Atha.Contracts;

namespace Atha
{
	public class AggregateTestResult : ITestRunTestResult
	{
		public AggregateTestResult(string name, IEnumerable<ITestRunTestResult> testResults)
		{
			this.Name = name;
			this.Results = testResults;
		}

		public string Name { get; private set; }

		public IEnumerable<ITestRunTestResult> Results { get; private set; }

		public bool Has(ITestRunTestResultStatus testRunTestResultStatus)
		{
			return this.Results.Any(r => r.Has(testRunTestResultStatus));
		}

		public bool Is(ITestRunTestResultStatus testRunTestResultStatus)
		{
			return this.Results.All(r => r.Is(testRunTestResultStatus));
		}
	}
}